home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 1642 < prev    next >
Encoding:
Text File  |  1996-08-06  |  3.1 KB  |  79 lines

  1. Newsgroups: comp.lang.c++
  2. Path: ncrgw2.ncr.com!ncrhub6!daynews!falcon!news
  3. From: Dick Menninger <Dick.Menninger@DaytonOH.ATTGIS.COM>
  4. Subject: Re: Difficulty hiring people with C++ experience.
  5. X-Nntp-Posting-Host: 149.25.99.44
  6. Message-ID: <DL1Dp5.H9z@falcon.daytonoh.attgis.com>
  7. Sender: news@falcon.daytonoh.attgis.com (News administrative Login)
  8. Reply-To: Dick.Menninger@DaytonOH.ATTGIS.COM (mennid)
  9. Organization: AT&T Global Information Solutions
  10. X-Newsreader: DiscussIT 2.5.1.3 for MS Windows [AT&T Software Products Division]
  11. References: <ALUN.CHAMPION.96Jan10160055@g7240065.bridge.bst.bls.com>
  12. Date: Thu, 11 Jan 1996 21:43:53 GMT
  13.  
  14.  
  15. > ==========Alun Champion, 1/10/96==========
  16. > In article <4d12p3$26lq@news.doit.wisc.edu>
  17. > keiter@hp-171.cae.wisc.edu (Eric Richard Keiter) writes:
  18. > : (Tom Donaldson) writes:
  19. > ::  When asked about
  20. > :: "programming by contract", the response is "Huh?"  The
  21.  
  22. [stuff deleted]
  23.  
  24. > : and what is programming by contract?  it sounds like an
  25. > obvious question
  26. > : -- is the answer not obvious?
  27.  
  28. > The contract between the user and its supplier is the set of
  29. > requests that
  30. > a user can make of that supplier. Programming by contract is the focus
  31. > of ensuring the supplier fulfils its contracts. Some aspects
  32. of the user
  33. > contract is enforced by the compiler like making methods private
  34. > or protected
  35. > but the ability to grant access for particular classes is not
  36. > possible at the
  37. > moment, so some reliance is on the user of the class to not
  38. > break its contract
  39. > with the supplier.
  40. > In a multi-threaded environment its very hard to guarentee the
  41. > contract between
  42. > user and supplier because the guarentee of the supplier can be
  43. broken by
  44. > another thread i.e. values changed etc.. In these situations
  45. you lock the
  46. > supplier so it can guarentee the contract for the period of that lock.
  47.  
  48. Well this might not have fully communicated the complete
  49. concept.  A contract provides the rules, invariants, rights
  50. and responsibilities of all parties involved.  It applies to
  51. functional interfaces that return stuff (e.g., the caller is
  52. responsible for destroying the stuff when done with it--
  53. is a contract part), as well.  The idea of contracts is to make
  54. all of the semantic properties and expectations more
  55. explicit and visible.  When a language includes mechanisms
  56. for specifying some of it, then more can be checked
  57. either at compile time or run-time.  A supplier could do
  58. some of this with ASSERT macros or statements in the
  59. supplier code, though the form may be less clear.
  60. But the user side is generally problematic to auto-verify.
  61. Worse, most of the contractual details the users needs
  62. to know are often undocumented, as well.  The more
  63. expensive bugs [bugs found late in testing and in released
  64. products] tend to be caused by poorly documented contracts
  65. or inconsistent contracts [it would be nice to have to state
  66. them in a way that most inconsistencies could be checked].
  67.  
  68. So, contracts are one place where program specification,
  69. program verification, automatic compile and run-time checking,
  70. and proof of correctness are likely to converge for significant
  71. subsets of software development.
  72.  
  73. Good Day
  74. Dick
  75. Dick.Menninger@DaytonOH.ATTGIS.COM
  76.  
  77.